﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Project
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        public  static  Dictionary<string, string> _user = new Dictionary<string, string>();
   
        
  
       
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //var uName = "sa";
            //var uPwd = "525200";
            var uid = userName.Text;
            var pwd = userPwd.Text;
            var reo = _user.Where (x =>x.Key ==uid).FirstOrDefault ();
            if (reo .Key ==uid  && reo .Value ==pwd )
            {
                MessageBox.Show("登录成功", "恭喜你", MessageBoxButtons.YesNo, MessageBoxIcon.Information );
             
            }
            else
            {
                MessageBox.Show("登录失败,你需要注册一个账号","很遗憾",MessageBoxButtons.YesNo ,MessageBoxIcon.Error);
            }
        }

        private  void Form1_Load(object sender, EventArgs e)
        {
            _user.Add("sa","252500");
        }
    }
}
